<template>
  <view class="page">
    <view class="pt-310rpx flex justify-center">
      <u-icon
        name="https://mp.weixin.qq.com/wxopen/basicprofile?action=get_headimg&token=756499006&t=1711464074153"
        size="200rpx"
        :label="appConfig.name"
        space="20rpx"
        label-size="32rpx"
        label-pos="bottom"
      />
    </view>
  </view>
</template>

<script lang="ts">
import { Component, Vue } from 'vue-property-decorator'

import { useGlobalSetting } from '@/settings'
import { userStore } from '@/store/modules'

@Component({ name: 'Redirect' })
export default class Redirect extends Vue {
  get appConfig() {
    return useGlobalSetting()
  }

  onLoad() {
    uni.hideHomeButton()
    console.log('this.appConfig.checkAuth', this.appConfig.checkAuth)
    // if (!this.appConfig.checkAuth) {
    //   setTimeout(() => {
    //     uni.switchTab({
    //       url: '/pages/index/index'
    //     })
    //   }, 1000)
    // } else {
    setTimeout(() => {
      if (userStore.hasLogin) {
        uni.switchTab({
          url: '/pages/index/index'
        })
      } else {
        uni.reLaunch({
          url: '/pages/identity/login'
        })
      }
    }, 1500)
  }
  // }
}
</script>

<style lang="scss" scoped>
.page {
  height: 100vh;
  background-color: #ffffff;
}
</style>
